package com.dingwen.frates.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.context.annotation.Configuration;

import java.time.LocalDateTime;

/**
 *  自动填充处理器
 *
 * @author dingwen
 * @date 2021.06.08 17:13
 * @since 1.0.0-SNAPSHOT
 */
@Configuration
public class MyMetaObjectHandlerConfiguration implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        // 注意此处是实体属性名称
        strictFillStrategy(metaObject,"createTime",LocalDateTime::now);
    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }
}
